# my_var = 10
# var_1 = 20
# var-var=10
# my.var=10
# print(var-var)
# print(my.var)
# print(my_var)
# print(var_1)
# 1var=30


# 大小写敏感
# myVar = 10
# myvar = 20
# print(myVar)
# print(myvar)

# 不能使用python保留字
# import keyword
# print(keyword.kwlist)


# print(keyword.iskeyword("def"))
# print(keyword.iskeyword("my_var"))


# import keyword
# print(keyword.softkwlist)
# print(keyword.issoftkeyword("_"))
# print(keyword.issoftkeyword("my_var"))


# 有意义的命名
# age = 25
# total_price = 100.50
# print(age)
# print(total_price)


# 特殊字符和变量名
# 下划线_
# _my_var = 10
# print(_my_var)
# my_var_2 = 20
# print(my_var_2)

# 双下划线
# class MyClass:
#     def __init__(self):
#         self.__private_var = 20

# obj = MyClass()
# # # print(obj.__private_var)e
# print(obj._MyClass__private_var)


# 数字类型
# x = 10
# y = 3.14
# z = 2 + 3j
# print(z)


# 字符串类型
# s1 = "hello"
# s2 = "world"

# 集合类型
# lst = [1, 2, 3]
# tup = (1, 2, 3)
# print(lst)
# print(tup)


# 布尔值
# flag = True
# print(flag)


# 字典类型
# my_dict = {"name": "Alice", "age": 25}
# print(my_dict)

# 变量命名的最佳实践
# total_price = 100
# first_name = "John"

# 基本赋值
# x =  10

# #多重赋值
# x, y, z = 1, 2, 3
# # print(x, y, z)

# # 交换变量值
# x, y = y,x
# print(x,y)


# x = x if x is not None else 10
# print(x)

# 扩展解包赋值
# a, *b, c = [1, 2, 3, 4, 5]
# print(a, b, c)

# 列表推导式赋值
# x = [i**2 for i in range(5)]
# print(x)

# 字典赋值
# my_dict = {}
# my_dict["name"] = "Alice"
# my_dict["age"] = 30
# print(my_dict)

# or赋值
# x = False
# x = x or 10
# print(x)

# 增量赋值
# x = 10
# x += 5
# print(x)

# 运算符赋值
# def func(*args):
#     a, b, *rest = args
#     print(a, b, rest)
# func(1, 2, 3, 4)

# 字典解包赋值
# dict1 = {'a': 1, 'b':2}
# dict2 = {'c': 3}
# merged_dict = {**dict1, **dict2}
# print(merged_dict)

# lambda表达式赋值
# square = lambda x: x**2
# print(square(5))

# 类型注解赋值
# x: int = 10
# name: str = "Alice"
# print(x, name)
# print(type(x),type(name))

# 常量赋值
# PI = 3.14149
# print(PI)


# global 和 nonlocal赋值
# x = 10
# def func():
#     global x
#     x = 20
#     print(x)

# func()

# def outer():
#     x = 10

#     def inner():
#         nonlocal x
#         x = 20
#         print(x)
#     inner()
# outer()